import { Entity, PrimaryGeneratedColumn, Column, OneToOne, JoinColumn } from "typeorm";
import { Identify } from "./identify.entity";

@Entity()
export class User {
  @PrimaryGeneratedColumn()
  id: number

  @Column({ comment: '用户账号', unique: true })
  username: string

  @Column({ comment: '用户昵称', unique: true })
  nickname: string

  @Column({ comment: '头像地址', unique: true })
  avatar: string

  @Column({ comment: '邮箱', unique: true })
  email: string

  @OneToOne(type => Identify, identify => identify.user)
  @JoinColumn({ name: 'identify_id' })
  identity: Identify
}
